+Sat Jan 24 23:17:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gtk/gtktoolbutton.c (gtk_tool_button_construct_contents): Only
+ try to pack icon if there actually is one.
+
+ * gtk/gtktoolbar.c (gtk_toolbar_size_allocate): Make sure
+ OVERFLOWN items get an allocation even when they are
+ unmapped. This ensures they will slide in properly.
+
+ * gtk/gtktoolbar.c (slide_idle_handler): Make sure we return TRUE
+ when there are overflown items that need to slide in. Also add
+ comments and make formatting more readable.
+
Sat Jan 24 17:38:48 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
+Sat Jan 24 23:17:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gtk/gtktoolbutton.c (gtk_tool_button_construct_contents): Only
+ try to pack icon if there actually is one.
+
+ * gtk/gtktoolbar.c (gtk_toolbar_size_allocate): Make sure
+ OVERFLOWN items get an allocation even when they are
+ unmapped. This ensures they will slide in properly.
+
+ * gtk/gtktoolbar.c (slide_idle_handler): Make sure we return TRUE
+ when there are overflown items that need to slide in. Also add
+ comments and make formatting more readable.
+
Sat Jan 24 17:38:48 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
+Sat Jan 24 23:17:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gtk/gtktoolbutton.c (gtk_tool_button_construct_contents): Only
+ try to pack icon if there actually is one.
+
+ * gtk/gtktoolbar.c (gtk_toolbar_size_allocate): Make sure
+ OVERFLOWN items get an allocation even when they are
+ unmapped. This ensures they will slide in properly.
+
+ * gtk/gtktoolbar.c (slide_idle_handler): Make sure we return TRUE
+ when there are overflown items that need to slide in. Also add
+ comments and make formatting more readable.
+
Sat Jan 24 17:38:48 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
+Sat Jan 24 23:17:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gtk/gtktoolbutton.c (gtk_tool_button_construct_contents): Only
+ try to pack icon if there actually is one.
+
+ * gtk/gtktoolbar.c (gtk_toolbar_size_allocate): Make sure
+ OVERFLOWN items get an allocation even when they are
+ unmapped. This ensures they will slide in properly.
+
+ * gtk/gtktoolbar.c (slide_idle_handler): Make sure we return TRUE
+ when there are overflown items that need to slide in. Also add
+ comments and make formatting more readable.
+
Sat Jan 24 17:38:48 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
+Sat Jan 24 23:17:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gtk/gtktoolbutton.c (gtk_tool_button_construct_contents): Only
+ try to pack icon if there actually is one.
+
+ * gtk/gtktoolbar.c (gtk_toolbar_size_allocate): Make sure
+ OVERFLOWN items get an allocation even when they are
+ unmapped. This ensures they will slide in properly.
+
+ * gtk/gtktoolbar.c (slide_idle_handler): Make sure we return TRUE
+ when there are overflown items that need to slide in. Also add
+ comments and make formatting more readable.
+
Sat Jan 24 17:38:48 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
ItemState state;
GtkAllocation goal_allocation;
GtkAllocation allocation;
-
+ gboolean cont;
+
state = toolbar_content_get_state (content);
toolbar_content_get_goal_allocation (content, &goal_allocation);
toolbar_content_get_allocation (content, &allocation);
- if ((state == NOT_ALLOCATED) ||
- (state == NORMAL &&
- toolbar_content_child_visible (content) &&
- ((goal_allocation.x != allocation.x ||
- goal_allocation.y != allocation.y ||
- goal_allocation.width != allocation.width ||
- goal_allocation.height != allocation.height))) ||
- (toolbar_content_is_placeholder (content) &&
+ cont = FALSE;
+
+ if (state == NOT_ALLOCATED)
+ {
+ /* an unallocated item means that size allocate has to
+ * called at least once more
+ */
+ cont = TRUE;
+ }
+
+ if ((state == NORMAL && toolbar_content_child_visible (content)) ||
+ state == OVERFLOWN)
+ {
+ if ((goal_allocation.x != allocation.x ||
+ goal_allocation.y != allocation.y ||
+ goal_allocation.width != allocation.width ||
+ goal_allocation.height != allocation.height))
+ {
+ /* An item is simply not in its right position yet. Note
+ * that OVERFLOWN items still get an allocation in
+ * gtk_toolbar_size_allocate(). This way you can see
+ * them slide in when you drag out of the toolbar
+ */
+ cont = TRUE;
+ }
+ }
+
+ if ((toolbar_content_is_placeholder (content) &&
toolbar_content_disappearing (content) &&
- toolbar_content_child_visible (content)))
+ (state == OVERFLOWN || toolbar_content_child_visible (content))))
+ {
+ /* A placeholder is disappearing, and it either hasn't disappeared
+ * yet, or is outside the toolbar.
+ */
+
+ cont = TRUE;
+ }
+
+ if (cont)
{
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (toolbar));
state = toolbar_content_get_state (content);
toolbar_content_get_allocation (content, &item_allocation);
- if (state == NORMAL &&
- rect_within (&item_allocation, &(widget->allocation)))
+ if ((state == NORMAL &&
+ rect_within (&item_allocation, &(widget->allocation))) ||
+ state == OVERFLOWN)
{
new_start_allocation = item_allocation;
}
{
overflowing = TRUE;
new_states[i] = OVERFLOWN;
+ allocations[i].width = item_size;
}
}
pos = border_width;
for (list = priv->content, i = 0; list != NULL; list = list->next, ++i)
{
- if (new_states[i] == NORMAL)
+ /* both NORMAL and OVERFLOWN items get a position. This ensures
+ * that sliding will work for OVERFLOWN items too
+ */
+ if (new_states[i] == NORMAL ||
+ new_states[i] == OVERFLOWN)
{
allocations[i].x = pos;
allocations[i].y = border_width;
if (new_states[i] != NORMAL)
{
toolbar_content_set_child_visible (content, toolbar, FALSE);
+ if (new_states[i] == OVERFLOWN)
+ toolbar_content_size_allocate (content, &allocations[i]);
}
else
{
{
alloc = allocations[i];
}
-
+
if (alloc.width == 0 || alloc.height == 0)
{
toolbar_content_set_child_visible (content, toolbar, FALSE);
toolbar_content_size_allocate (content, &alloc);
}
}
-
+
toolbar_content_set_state (content, new_states[i]);
}
case GTK_TOOLBAR_BOTH_HORIZ:
box = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box), icon, label? FALSE : TRUE, TRUE, 0);
+ if (icon)
+ gtk_box_pack_start (GTK_BOX (box), icon, label? FALSE : TRUE, TRUE, 0);
if (label)
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (button->priv->button), box);